/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.childcare.buz;

import com.aptech.childcare.dao.ActivitiesDAO;
import com.aptech.childcare.dao.AgegroupDAO;
import com.aptech.childcare.dao.ChildDAO;
import com.aptech.childcare.dao.ClassDAO;
import com.aptech.childcare.dao.NannyDAO;
import com.aptech.childcare.dao.StaffDAO;
import com.aptech.childcare.entities.Activities;
import com.aptech.childcare.entities.Agegroup;
import com.aptech.childcare.entities.Child;
import com.aptech.childcare.entities.ClassChild;
import com.aptech.childcare.entities.Nanny;
import com.aptech.childcare.entities.Staff;
import java.io.IOException;
import java.util.ArrayList;

/**
 *
 * @author BaoTien
 */
public class ChildcareBuz {

    public StaffDAO stdao = new StaffDAO();
    public NannyDAO nadao = new NannyDAO();
    public ClassDAO cldao = new ClassDAO();
    public ChildDAO chdao = new ChildDAO();
    public AgegroupDAO agedao = new AgegroupDAO();
    public ActivitiesDAO acdao = new ActivitiesDAO();
    Staff sta = new Staff();
    Nanny na = new Nanny();

    /** Default constructor of ChildcareBUZ */
    public ChildcareBuz() {
    }

    /**
     *
     * @param sta
     * @return
     */
    public boolean createStaff(Staff sta) throws IOException {
        return stdao.create(sta);
    }

    /**
     *
     * @param sta
     * @return
    //     */
    public boolean storeStaff(Staff sta) throws IOException {
        return stdao.update(sta);
    }

    /**
     * 
     * @param sta
     * @return
     */
    public boolean storeAccount(Staff sta) throws IOException {
        return stdao.updateAccount(sta);
    }

    /**
     * 
     * @param UserName
     * @return
     */
    public Staff findByAcc(String UserName) throws IOException {
        return stdao.readByAcc(UserName);
    }

    /**
     *
     * @return
     */
    public ArrayList<Staff> findStaff() throws IOException {
        return stdao.readByAll();
    }

    /**
     * 
     * @param sta
     * @param oldPass
     * @return
     */
    public boolean changePass(Staff sta, String oldPass) throws IOException {
        return stdao.changePass(sta, oldPass);
    }

    /**
     *
     * @param sta
     * @return
     */
    public boolean checkAccStaff(Staff sta) throws IOException {
        return stdao.checkAcc(sta);
    }

    /**
     *
     * @param staffID
     * @return
     */
    public boolean removeStaff(int staffID, String userName) throws IOException {
        return stdao.delete(staffID, userName);
    }

    /**
     *
     * @param staName
     * @return
     */
    public ArrayList<Staff> findByNameStaff(String Name) throws IOException {
        return stdao.readByName(Name);
    }

    /**
     *
     * @param na
     * @return
     */
    public boolean createNanny(Nanny na) throws IOException {
        return nadao.create(na);
    }

    /**
     *
     * @param na
     * @return
     */
    public boolean storeNanny(Nanny na) throws IOException {
        return nadao.update(na);
    }

    public ArrayList<Nanny> findNanny() throws IOException {
        return nadao.readByAll();
    }

    /**
     *
     * @param nannyID
     * @return
     */
    public boolean removeNanny(int nannyID)  throws IOException{
        return nadao.delete(nannyID);
    }

    /**
     *
     * @param Name
     * @return
     */
    public ArrayList<Nanny> findByNameNanny(String Name)  throws IOException{
        return nadao.readByName(Name);
    }

    /**
     *
     * @return
     */
    public ArrayList<Activities> findlActivities()  throws IOException{
        return acdao.readByAll();
    }

    /**
     *
     * @param name
     * @return
     */
    public ArrayList<Activities> findlActivities(String name)  throws IOException{
        return acdao.readByName(name);
    }

    /**
     *
     * @param act
     * @return
     */
    public boolean createActivitiess(Activities act)  throws IOException{
        return acdao.create(act);
    }

    /**
     *
     * @param act
     * @return
     */
    public boolean removeActivities(int activeID)  throws IOException{
        return acdao.delete(activeID);
    }

    /**
     *
     * @param act
     * @return
     */
    public boolean storeActivities(Activities act)  throws IOException{
        return acdao.update(act);
    }

    /**
     *
     * @param cl
     * @return
     */
    public boolean createClass(ClassChild cl)  throws IOException{
        return cldao.create(cl);
    }

    /**
     *
     * @param cl
     * @return
     */
    public boolean storeClass(ClassChild cl)  throws IOException{
        return cldao.update(cl);
    }

    /**
     *
     * @return
     */
    public ArrayList<ClassChild> findClass()  throws IOException{
        return cldao.readByAll();
    }

    /**
     *
     * @param name
     * @return
     */
    public ArrayList<ClassChild> findClass(String name) throws IOException {
        return cldao.readByName(name);
    }

    /**
     *
     * @param ClassID
     * @return
     */
    public ClassChild findByID(int ClassID) throws IOException {
        return cldao.readByID(ClassID);
    }

    /**
     * 
     * @param AgegroupID
     * @return
     */
    public ClassChild readByIDAge(int AgegroupID) throws IOException {
        return cldao.readByIDAge(AgegroupID);
    }

    /**
     *
     * @param ClassID
     * @return
     */
    public boolean removeClass(int ClassID)  throws IOException{
        return cldao.delete(ClassID);
    }

    /**
     *
     * @param age
     * @return
     */
    public boolean createAgegroup(Agegroup age)  throws IOException{
        return agedao.create(age);
    }

    /**
     *
     * @param age
     * @return
     */
    public boolean storeAgegroup(Agegroup age) throws IOException {
        return agedao.update(age);
    }

    /**
     *
     * @return
     */
    public ArrayList<Agegroup> findAgegroup()  throws IOException{
        return agedao.readByAll();
    }

    /**
     *
     * @param name
     * @return
     */
    public ArrayList<Agegroup> findAgegroup(String name)  throws IOException{
        return agedao.readByName(name);
    }

    /**
     * 
     * @param AgegroupID
     * @return
     */
    public Agegroup findByIDAge(int AgegroupID)  throws IOException{
        return agedao.readByID(AgegroupID);
    }

    /**
     *
     * @param ageGroupID
     * @return
     */
    public boolean removeAgegroup(int ageGroupID)  throws IOException{
        return agedao.delete(ageGroupID);
    }

    /**
     * 
     * @param chi
     * @return
     */
    public boolean createChild(Child chi)  throws IOException{
        return chdao.create(chi);
    }

    /**
     * 
     * @return
     */
    public ArrayList<Child> findChild()  throws IOException{
        return chdao.readByAll();
    }

    /**
     * 
     * @param chi
     * @return
     */
    public boolean storeChild(Child chi)  throws IOException{
        return chdao.update(chi);
    }

    /**
     * 
     * @param ChildID
     * @return
     */
    public boolean removeChild(int ChildID)  throws IOException{
        return chdao.delete(ChildID);
    }

    /**
     *
     * @param Name
     * @return
     */
    public ArrayList<Child> findChild(String Name)  throws IOException{
        return chdao.readByName(Name);
    }

    public ArrayList<Child> findByAllIDChild(int ClassID) throws IOException {
        return chdao.readByAllIDChild(ClassID);
    }
}

